<include file="plugin/functions"/>
<include file="public@header"/>
<style>
    html{background-color: #fff}
</style>
</head>
<body>
<form method="post" class="layui-form js-ajax-form" action="{:url('plugin/settingPost')}" style="padding: 20px 30px 0 0;">
    <empty name="custom_config">
        {:_parse_plugin_config($data['config'])}
        <else/>
        <present name="custom_config">
            {$custom_config}
        </present>
    </empty>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <input type="hidden" name="id" value="{$id}" readonly>
            <button type="submit" class="layui-btn js-ajax-submit">保存</button>
        </div>
    </div>
</form>
<include file="public@script"/>
<script>

    Wind.use('colorpicker',function(){
        $('.js-color').each(function () {
            var $this=$(this);
            $this.ColorPicker({
                livePreview:true,
                onChange: function(hsb, hex, rgb) {
                    $this.val('#'+hex);
                },
                onBeforeShow: function () {
                    $(this).ColorPickerSetColor(this.value);
                }
            });
        });

    });

    function doSelectLocation(obj) {
        var $obj       = $(obj);
        var title      = $obj.data('title');
        var $realInput = $obj;
        var location   = $realInput.val();

        admin.openIframeLayer(
            "{:url('dialog/map')}?location=" + location,
            title,
            {
                area: ['700px', '90%'],
                btn: ['确定', '取消'],
                yes: function (index, layero) {
                    var iframeWin = parent.window[layero.find('iframe')[0]['name']];
                    var location  = iframeWin.confirm();
                    $realInput.val(location.lng + ',' + location.lat);
                    //$obj.val(location.address);
                    parent.layer.close(index); //如果设定了yes回调，需进行手工关闭
                }
            }
        );
    }
</script>
</body>
</html>